#include <iostream>
using namespace std;
class S
{
public:
    int a;
    // mutable 关键字本意是修饰一些非静态成员，使得它们在整个对象为 const 时仍然可以改动
    mutable int b;
    // 突破const成员函数的限制
    S(int a, int b) : a{a}, b{b} {}
    void foo() const
    {
        // a++;
        b++;
        cout << "foo's a is " << a << endl;
        cout << "foo's b is " << b << endl;
    }
};
int main()
{
    const S s1(1, 2);
    cout << s1.a << endl;
    cout << s1.b << endl;
    // s1.a = 9;
    // b 被 mutable 了，可以修改
    s1.b = 9;
    cout << s1.a << endl;
    cout << s1.b << endl;
    s1.foo();
    return 0;
}
